package ar.dvorakes.generator;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class GUIBINUnitsContainer {

	private int unitSize = 0;

	private Map<String, GUIBINUnit> set = new HashMap<String, GUIBINUnit>();

	public GUIBINUnitsContainer(List<GUIBINUnit> set) {
		if (set.get(0) != null) {
			for (GUIBINUnit unit : set) {
				this.set.put(unit.getValue(), unit);
			}
			this.unitSize = set.get(0).getValue().length();
		}
	}

	public int getUnitsSize() {
		return this.unitSize;
	}

	public void addHit(String value) {
		if (set.get(value) != null) {
			set.get(value).incrementHits();
		}
	}

	public GUIBINUnit getUnit(String key) {
		return this.set.get(key);
	}

	public String toString() {
		return "{Unit Size: " + String.valueOf(this.unitSize) + ", Units: "
				+ this.set.toString() + "}";
	}

}
